package com.itheima.web;

import com.itheima.service.OrdersService;
import com.itheima.bean.Orders;
import com.itheima.common.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    //提交订单
    @PostMapping("/order/submit")
    public R submit(@RequestBody Orders orders){
        boolean result = ordersService.add(orders);

        if(result){
            return R.success("添加成功");
        }
        return R.error("添加失败");
    }
}
